package spring.factory;

import org.springframework.beans.factory.FactoryBean;
import spring.model.Car;

/**
 * Administrator
 *
 * @author jiangbang
 * @date 2016/11/8
 */
public class CarFactoryBean implements FactoryBean {
    private String bread;
    public void setBread(String bread){
        this.bread = bread;
    }

    /**
     * 返回bean的对象
     * @return
     * @throws Exception
     */
    @Override
    public Object getObject() throws Exception {
        return new Car(bread,"500");
    }

    /**
     * 返回bean的类型
     * @return
     */
    @Override
    public Class<?> getObjectType() {
        return Car.class;
    }
    //是否单例
    @Override
    public boolean isSingleton() {
        return true;
    }
}
